<?php

namespace maotool\util;

/**
 * 数字工具类
 */
class NumberUtil
{

    /**
     * 十分比计算
     * @param $total
     * @param $part
     * @param $precision
     * @param $model
     * @return float|string
     */
    public static function tenPercent($total, $part, $precision = 0, $model = true)
    {
        return MathUtil::cutCalculate($total, $part, 10, $precision, $model);
    }

    /**
     * 百分比计算
     * @param $total
     * @param $part
     * @param $precision
     * @param $model
     * @return float|string
     */
    public static function percentage($total, $part, $precision = 0, $model = true)
    {
        return MathUtil::cutCalculate($total, $part, 100, $precision, $model);
    }

    /**
     * 千分比计算
     * @param $total
     * @param $part
     * @param $precision
     * @param $model
     * @return float|string
     */
    public static function thousandthRatio($total, $part, $precision = 0, $model = true)
    {
        return MathUtil::cutCalculate($total, $part, 1000, $precision, $model);
    }

}